//
//@File    :	4.8_strtype2.cpp
//@Time    :	2021/08/03 15:19:16
//@Auther  :	Sun Sheng
//@Contact :	970340843@qq.com
//@Desc    :	assigning,adding,and appending
//

#include <string>
#include <iostream>

int main()
{
    using namespace std;
    string s1 = "penguin";
    string s2,s3;

    cout<<"You can assign one string object to another:s2=s1\n";
    s2 = s1;
    cout<<"s1:"<<s1<<",s2:"<<s2<<endl;
    cout<<"You can assign a C-style string to a string object.\n";
    cout<<"s2\"buzzard\"\n";
    s2 = "buzzard";
    cout<<"s2:"<<s2<<endl;
    cout<<"You can concatenate strings:s3 = s1 +s2\n";
    s3 = s1 + s2;
    cout<<"s3:"<<s3<<endl;
    cout<<"You can append strings.\n";
    s1+=s2;
    cout<<"s1+=s2 yielfs s1 = "<<s1<<endl;
    s2+=" for a day";
    cout<<"s2 +=\"for a day\"yields s2 = "<<s2<<endl;
    system("pause");
    return 0;
}